package com.tide.crm.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.tide.crm.model.CustomContactStakeholder;

@Mapper
public interface CustomContactStakeholderDao {

    @Select("select * from custom_contact_stakeholder t where t.id = #{id}")
    CustomContactStakeholder getById(Long id);

    @Delete("delete from custom_contact_stakeholder where id = #{id}")
    int delete(Long id);

    int update(CustomContactStakeholder customContactStakeholder);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into custom_contact_stakeholder(contact_id, create_date, creater, modify_date, modifyer, stakeholder_name, stakeholder_relationship) values(#{contactId}, #{createDate}, #{creater}, #{modifyDate}, #{modifyer}, #{stakeholderName}, #{stakeholderRelationship})")
    int save(CustomContactStakeholder customContactStakeholder);
    
    int count(@Param("params") Map<String, Object> params);

    List<CustomContactStakeholder> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
